package com.beyondsoft.sabg.edu.repository;

import com.beyondsoft.sabg.edu.model.db.DocumentContent;
import com.beyondsoft.sabg.edu.repository.core.SimpleRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface DocumentContentRepo extends SimpleRepository<DocumentContent> {
    
    @Query(value = "select * from document_content where document_type = ?1 order by create_time desc", nativeQuery = true)
    List<DocumentContent> findByDocumentTypeOrderByCreatedTimeDesc(String documentType);
    
    @Query(value = "select * from document_content where title like %?1% order by create_time desc", nativeQuery = true)
    List<DocumentContent> findByTitleContainingOrderByCreatedTimeDesc(String title);
} 